package org.celery.modules.purchase.wrapper;

import lombok.AllArgsConstructor;
import org.celery.modules.purchase.enums.PurchaseStatusEnum;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.celery.modules.purchase.entity.Purchase;
import org.celery.modules.purchase.vo.PurchaseVO;

/**
 * 店铺表包装类,返回视图层所需的字段
 *
 * @author Celery
 * @since 2023-07-16
 */
public class PurchaseWrapper extends BaseEntityWrapper<Purchase, PurchaseVO>  {

    public static PurchaseWrapper build() {
        return new PurchaseWrapper();
    }

	@Override
	public PurchaseVO entityVO(Purchase purchase) {
		PurchaseVO purchaseVO = BeanUtil.copy(purchase, PurchaseVO.class);

		purchaseVO.setStatusName(PurchaseStatusEnum.getName(purchase.getStatus()));

		return purchaseVO;
	}

}
